// -*- go -*-
//

package main

import (
	"math"
)

type Size = uint64

type Garbler struct {
	msg       Size
	privShare Size
	pubN      Size
	pubE      Size
}

func main(g Garbler, privShare Size) (uint, uint) {

	priv := g.privShare + privShare

	cipher := Encrypt(g.msg, g.pubE, g.pubN)
	plain := Decrypt(cipher, priv, g.pubN)

	return cipher, plain
}

func Encrypt(msg, e, n uint) uint {
	return math.ExpMontgomery(msg, e, n)
}

func Decrypt(cipher, d, n uint) uint {
	return math.ExpMontgomery(cipher, d, n)
}
